'use strict'

class info {

  constructor () {
    //param默认就是/:id，若要改变路由，则可以设置此属性，比如设置为/:name
    //this.param = '/:id'
  }

  //以下方法，若不需要，要去掉，避免无意义的路由。

  //获取资源具体内容
  async get (c) {

  }

  //有则更新，无则写入
  async post (c) {
    let u = c.box.user;
    let sqltext = `SELECT * FROM users where open_id = $1`;
    let r = await c.service.psql.query(sqltext, [u.openid]);
    if (r.rowCount <= 0) {
        //写入
        sqltext = `INSERT INTO users(open_id,)`;
    } else {
        //更新
    }

  }

}

module.exports = info
